/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package UML_ER.impl;

import UML_ER.Completness;
import UML_ER.Disjointness;
import UML_ER.GeneralizationCategory;
import UML_ER.UML_ERPackage;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Generalization Category</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link UML_ER.impl.GeneralizationCategoryImpl#getDisjointness <em>Disjointness</em>}</li>
 *   <li>{@link UML_ER.impl.GeneralizationCategoryImpl#getCompleteness <em>Completeness</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class GeneralizationCategoryImpl extends ElementImpl implements GeneralizationCategory {
	/**
	 * The default value of the '{@link #getDisjointness() <em>Disjointness</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDisjointness()
	 * @generated
	 * @ordered
	 */
	protected static final Disjointness DISJOINTNESS_EDEFAULT = Disjointness.OVERLAP;
	/**
	 * The cached value of the '{@link #getDisjointness() <em>Disjointness</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getDisjointness()
	 * @generated
	 * @ordered
	 */
	protected Disjointness disjointness = DISJOINTNESS_EDEFAULT;
	/**
	 * The default value of the '{@link #getCompleteness() <em>Completeness</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCompleteness()
	 * @generated
	 * @ordered
	 */
	protected static final Completness COMPLETENESS_EDEFAULT = Completness.PARTIAL;
	/**
	 * The cached value of the '{@link #getCompleteness() <em>Completeness</em>}' attribute.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getCompleteness()
	 * @generated
	 * @ordered
	 */
	protected Completness completeness = COMPLETENESS_EDEFAULT;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected GeneralizationCategoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return UML_ERPackage.Literals.GENERALIZATION_CATEGORY;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Disjointness getDisjointness() {
		return disjointness;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setDisjointness(Disjointness newDisjointness) {
		Disjointness oldDisjointness = disjointness;
		disjointness = newDisjointness == null ? DISJOINTNESS_EDEFAULT : newDisjointness;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, UML_ERPackage.GENERALIZATION_CATEGORY__DISJOINTNESS, oldDisjointness, disjointness));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Completness getCompleteness() {
		return completeness;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setCompleteness(Completness newCompleteness) {
		Completness oldCompleteness = completeness;
		completeness = newCompleteness == null ? COMPLETENESS_EDEFAULT : newCompleteness;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, UML_ERPackage.GENERALIZATION_CATEGORY__COMPLETENESS, oldCompleteness, completeness));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case UML_ERPackage.GENERALIZATION_CATEGORY__DISJOINTNESS:
				return getDisjointness();
			case UML_ERPackage.GENERALIZATION_CATEGORY__COMPLETENESS:
				return getCompleteness();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case UML_ERPackage.GENERALIZATION_CATEGORY__DISJOINTNESS:
				setDisjointness((Disjointness)newValue);
				return;
			case UML_ERPackage.GENERALIZATION_CATEGORY__COMPLETENESS:
				setCompleteness((Completness)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case UML_ERPackage.GENERALIZATION_CATEGORY__DISJOINTNESS:
				setDisjointness(DISJOINTNESS_EDEFAULT);
				return;
			case UML_ERPackage.GENERALIZATION_CATEGORY__COMPLETENESS:
				setCompleteness(COMPLETENESS_EDEFAULT);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case UML_ERPackage.GENERALIZATION_CATEGORY__DISJOINTNESS:
				return disjointness != DISJOINTNESS_EDEFAULT;
			case UML_ERPackage.GENERALIZATION_CATEGORY__COMPLETENESS:
				return completeness != COMPLETENESS_EDEFAULT;
		}
		return super.eIsSet(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String toString() {
		if (eIsProxy()) return super.toString();

		StringBuffer result = new StringBuffer(super.toString());
		result.append(" (disjointness: ");
		result.append(disjointness);
		result.append(", completeness: ");
		result.append(completeness);
		result.append(')');
		return result.toString();
	}

} //GeneralizationCategoryImpl
